import 'package:xin_nuo_pda/bean/bin_info_entity.dart';

binInfoEntityFromJson(BinInfoEntity data, Map<String, dynamic> json) {
	if (json['ISTESTTYPE'] != null) {
		data.ISTESTTYPE = json['ISTESTTYPE'].toString();
	}
	if (json['TESTTYPE'] != null) {
		data.TESTTYPE = json['TESTTYPE'] is String
				? int.tryParse(json['TESTTYPE'])
				: json['TESTTYPE'].toInt();
	}
	if (json['LOTID'] != null) {
		data.LOTID = json['LOTID'].toString();
	}
	if (json['LOTCOUNT'] != null) {
		data.LOTCOUNT = json['LOTCOUNT'].toString();
	}
	if (json['TESTERIDS'] != null) {
		data.TESTERIDS = json['TESTERIDS'].toString();
	}
	if (json['PRODUCTMODEL'] != null) {
		data.PRODUCTMODEL = json['PRODUCTMODEL'].toString();
	}
	if (json['EQPTYPE'] != null) {
		data.EQPTYPE = json['EQPTYPE'].toString();
	}
	if (json['GRADINGMARKER'] != null) {
		data.GRADINGMARKER = json['GRADINGMARKER'].toString();
	}
	if (json['HBINLIST'] != null) {
		data.HBINLIST = (json['HBINLIST'] as List).map((v) => BinInfo().fromJson(v)).toList();
	}
	if (json['LOTBINDATALIST'] != null) {
		data.LOTBINDATALIST = (json['LOTBINDATALIST'] as List).map((v) => BinInfo().fromJson(v)).toList();
	}
	return data;
}

Map<String, dynamic> binInfoEntityToJson(BinInfoEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['ISTESTTYPE'] = entity.ISTESTTYPE;
	data['TESTTYPE'] = entity.TESTTYPE;
	data['LOTID'] = entity.LOTID;
	data['LOTCOUNT'] = entity.LOTCOUNT;
	data['TESTERIDS'] = entity.TESTERIDS;
	data['PRODUCTMODEL'] = entity.PRODUCTMODEL;
	data['EQPTYPE'] = entity.EQPTYPE;
	data['GRADINGMARKER'] = entity.GRADINGMARKER;
	data['HBINLIST'] =  entity.HBINLIST?.map((v) => v.toJson())?.toList();
	data['LOTBINDATALIST'] =  entity.LOTBINDATALIST?.map((v) => v.toJson())?.toList();
	return data;
}

binInfoFromJson(BinInfo data, Map<String, dynamic> json) {
	if (json['BINNO'] != null) {
		data.BINNO = json['BINNO'].toString();
	}
	if (json['BINNAME'] != null) {
		data.BINNAME = json['BINNAME'].toString();
	}
	if (json['BINACTUAL'] != null) {
		data.BINACTUAL = json['BINACTUAL'].toString();
	}
	if (json['BINQTY'] != null) {
		data.BINQTY = json['BINQTY'] is String
				? int.tryParse(json['BINQTY'])
				: json['BINQTY'].toInt();
	}
	if (json['BINDESC'] != null) {
		data.BINDESC = json['BINDESC'].toString();
	}
	if (json['CLEARTYPE'] != null) {
		data.CLEARTYPE = json['CLEARTYPE'].toString();
	}
	if (json['LOTID'] != null) {
		data.LOTID = json['LOTID'].toString();
	}
	if (json['MAINQTY'] != null) {
		data.MAINQTY = json['MAINQTY'] is String
				? int.tryParse(json['MAINQTY'])
				: json['MAINQTY'].toInt();
	}
	return data;
}

Map<String, dynamic> binInfoToJson(BinInfo entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['BINNO'] = entity.BINNO;
	data['BINNAME'] = entity.BINNAME;
	data['BINACTUAL'] = entity.BINACTUAL;
	data['BINQTY'] = entity.BINQTY;
	data['BINDESC'] = entity.BINDESC;
	data['CLEARTYPE'] = entity.CLEARTYPE;
	data['LOTID'] = entity.LOTID;
	data['MAINQTY'] = entity.MAINQTY;
	return data;
}